#pragma once
#include "audio_input.h"
#include "audio_sample.h"

#include <string>

namespace krryn{
namespace audio_imp{
	class wave_chunk_riff;
	class wave_chunk_fmt;
};

namespace audio{
	class input_wave : public input{
	public:
		typedef core::refc_ptr<input_wave> ptr;

		input_wave(const std::string &a_Filename);
		virtual ~input_wave();

		virtual sample::ptr next(int a_MilliSeconds);
		virtual void reset();
		virtual bool more();
	private:
		std::ifstream *m_Input;
		bool m_Init;

		int m_SampleRate;
		int m_InitialPosition;
		int m_TotalRead;
		int m_TotalSize;
		int m_ByteRate;
		const int m_MaxBlockSize;

		void init();

		std::string m_Filename;
	};
}
}
